<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="javax.xml.soap.Text"%>
<%@page import="com.mapbar.util.TextCodec"%>
<%@page import="com.mapbar.util.IDCodec"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

Cookie cookies []= request.getCookies();
if(cookies != null){
	int length = cookies.length;
	Cookie cookie = null;
	String userId = null;
	String userIdc = null;
	String userName = null;
	//init
	for(int i = 0 ; i < length ; i++){
		cookie = cookies[i];
		if(cookie == null)
			continue;
		else if("userId".equals(cookie.getName())){
			userId = cookie.getValue();
		}else if("userIdc".equals(cookie.getName())){
			userIdc = cookie.getValue();
		}else if("userName".equals(cookie.getName())){
			userName = cookie.getValue();
		}
	}
	//out.println(TextCodec.encode(IDCodec.encode(userId)));
	
	//out.println(userId+","+IDCodec.decode(TextCodec.decode(userIdc)));
	if(userId != null && userIdc != null && userName != null && !"".equals(userId) && !"".equals(userIdc) && !"".equals(userName)){
		if(userIdc.indexOf("%25") >= 0)
			userIdc = userIdc.replaceAll("%25" , "%");
		userIdc = IDCodec.decode(TextCodec.decode(userIdc));
		if(userId.equals(userIdc)){
			request.setAttribute("userName" , userName);
			request.setAttribute("userId" , userId);
		}
	}
	
}

%>
<div class="header">
	<c:if test="${not empty userName}">
		<span class="userPanel" id="logonInfo"><a href="http://www.mapbar.com/" target="_blank">访问图吧首页</a>&nbsp;<span><a href="http://my.mapbar.com/maps/${userId}/myindex/" target="_blank">${userName}</a>，欢迎回来！</span>&nbsp;<span><a href="javascript:;" onclick="mobile.logon.logonOut();return false;">注销</a></span>&nbsp;<span><a href="http://my.mapbar.com/" target="_blank">进入图吧家园</a></span></span>
	</c:if>
	<c:if test="${empty userName}">
		<span class="userPanel" id="logonInfo"><a href="http://www.mapbar.com/" target="_blank">访问图吧首页</a>&nbsp;<span><a href="javascript:;" onclick="mobile.logon.showPan();return false;">登录</a></span>&nbsp;<span><a href="http://my.mapbar.com/" target="_blank">进入图吧家园</a></span></span>
	</c:if>
   	<div class="serLogo">
        	<a href="http://www.mapbar.com" class="mapbarLogo" target="_blank"><img src="images/mapbarLogo.gif" alt=""/></a>
            <a href="http://mobile.mapbar.com" target="_blank"><img src="images/moLogo.gif" alt=""/></a>
            <img class="moSol" src="images/moSol.gif" alt=""/>        
     </div>
</div>